<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Mixpanel Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>
    <script src="../js/jquery.min.js" defer></script>
    <script src="../js/jazzy.js" defer></script>
    
    <script src="../js/lunr.min.js" defer></script>
    <script src="../js/typeahead.jquery.js" defer></script>
    <script src="../js/jazzy.search.js" defer></script>
  </head>
  <body>
    <a name="//apple_ref/swift/Class/Mixpanel" class="dashAnchor"></a>
    <a title="Mixpanel Class Reference"></a>
    <header>
      <div class="content-wrapper">
        <p><a href="../index.html">Mixpanel 5.0.0 Docs</a> (77% documented)</p>
        <p class="header-right"><a href="https://github.com/mixpanel/mixpanel-swift"><img src="../img/gh.png" alt="GitHub"/>View on GitHub</a></p>
        <div class="header-right">
          <form role="search" action="../search.json">
            <input type="text" placeholder="Search documentation" data-typeahead>
          </form>
        </div>
      </div>
    </header>
    <div class="content-wrapper">
      <p id="breadcrumbs">
        <a href="../index.html">Mixpanel Reference</a>
        <img id="carat" src="../img/carat.png" alt=""/>
        Mixpanel Class Reference
      </p>
    </div>
    <div class="content-wrapper">
      <nav class="sidebar">
        <ul class="nav-groups">
          <li class="nav-group-name">
            <a href="../Classes.html">Classes</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Classes/Group.html">Group</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/Mixpanel.html">Mixpanel</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/MixpanelInstance.html">MixpanelInstance</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/MixpanelLogger.html">MixpanelLogger</a>
              </li>
              <li class="nav-group-task">
                <a href="../Classes/People.html">People</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Enums.html">Enumerations</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Enums/GzipError.html">GzipError</a>
              </li>
              <li class="nav-group-task">
                <a href="../Enums/MixpanelLogLevel.html">MixpanelLogLevel</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Extensions.html">Extensions</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Extensions/Array.html">Array</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/Bool.html">Bool</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/Data.html">Data</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/Date.html">Date</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/Dictionary.html">Dictionary</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/Double.html">Double</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/Float.html">Float</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/Int.html">Int</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/NSArray.html">NSArray</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/NSNull.html">NSNull</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/NSNumber.html">NSNumber</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/NSString.html">NSString</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/Optional.html">Optional</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/String.html">String</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/UInt.html">UInt</a>
              </li>
              <li class="nav-group-task">
                <a href="../Extensions/URL.html">URL</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Protocols.html">Protocols</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Protocols/MixpanelDelegate.html">MixpanelDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="../Protocols/MixpanelLogging.html">MixpanelLogging</a>
              </li>
              <li class="nav-group-task">
                <a href="../Protocols/MixpanelProxyServerDelegate.html">MixpanelProxyServerDelegate</a>
              </li>
              <li class="nav-group-task">
                <a href="../Protocols/MixpanelType.html">MixpanelType</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Structs.html">Structures</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Structs/MixpanelLogMessage.html">MixpanelLogMessage</a>
              </li>
              <li class="nav-group-task">
                <a href="../Structs/ProxyServerConfig.html">ProxyServerConfig</a>
              </li>
              <li class="nav-group-task">
                <a href="../Structs/ServerProxyResource.html">ServerProxyResource</a>
              </li>
            </ul>
          </li>
          <li class="nav-group-name">
            <a href="../Typealiases.html">Type Aliases</a>
            <ul class="nav-group-tasks">
              <li class="nav-group-task">
                <a href="../Typealiases.html#/s:8Mixpanel10Propertiesa">Properties</a>
              </li>
            </ul>
          </li>
        </ul>
      </nav>
      <article class="main-content">
        <section>
          <section class="section">
            <h1>Mixpanel</h1>
              <div class="declaration">
                <div class="language">
                  
                  <pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kt">Mixpanel</span></code></pre>

                </div>
              </div>
            <p>The primary class for integrating Mixpanel with your app.</p>

          </section>
          <section class="section task-group-section">
            <div class="task-group">
              <ul>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8MixpanelAAC10initialize5token20trackAutomaticEvents13flushInterval12instanceName23optOutTrackingByDefault19useUniqueDistinctId15superProperties9serverURL0P15GzipCompressionAA0A8InstanceCSS_SbSdSSSgS2bSDySSAA0A4Type_pGSgAOSbtFZ"></a>
                    <a name="//apple_ref/swift/Method/initialize(token:trackAutomaticEvents:flushInterval:instanceName:optOutTrackingByDefault:useUniqueDistinctId:superProperties:serverURL:useGzipCompression:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8MixpanelAAC10initialize5token20trackAutomaticEvents13flushInterval12instanceName23optOutTrackingByDefault19useUniqueDistinctId15superProperties9serverURL0P15GzipCompressionAA0A8InstanceCSS_SbSdSSSgS2bSDySSAA0A4Type_pGSgAOSbtFZ">initialize(token:<wbr>trackAutomaticEvents:<wbr>flushInterval:<wbr>instanceName:<wbr>optOutTrackingByDefault:<wbr>useUniqueDistinctId:<wbr>superProperties:<wbr>serverURL:<wbr>useGzipCompression:<wbr>)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Initializes an instance of the API with the given project token.</p>

<p>Returns a new Mixpanel instance API object. This allows you to create more than one instance
of the API object, which is convenient if you&rsquo;d like to send data to more than
one Mixpanel project from a single app.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>If you have more than one Mixpanel instance, it is beneficial to initialize
the instances with an instanceName. Then they can be reached by calling getInstance with name.</p>

</div>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">open</span> <span class="kd">class</span> <span class="kd">func</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">token</span> <span class="nv">apiToken</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
                           <span class="nv">trackAutomaticEvents</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">,</span>
                           <span class="nv">flushInterval</span><span class="p">:</span> <span class="kt">Double</span> <span class="o">=</span> <span class="mi">60</span><span class="p">,</span>
                           <span class="nv">instanceName</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
                           <span class="nv">optOutTrackingByDefault</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
                           <span class="nv">useUniqueDistinctId</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
                           <span class="nv">superProperties</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:8Mixpanel10Propertiesa">Properties</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
                           <span class="nv">serverURL</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
                           <span class="nv">useGzipCompression</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/MixpanelInstance.html">MixpanelInstance</a></span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>token</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>your project token</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>trackAutomaticEvents</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Whether or not to collect common mobile events</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>flushInterval</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Interval to run background flushing</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>instanceName</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. The name you want to uniquely identify the Mixpanel Instance.
It is useful when you want more than one Mixpanel instance under the same project token.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>optOutTrackingByDefault</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Whether or not to be opted out from tracking by default</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>useUniqueDistinctId</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. whether or not to use the unique device identifier as the distinct_id</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>superProperties</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Super properties dictionary to register during initialization</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>serverURL</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Mixpanel cluster URL</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>useGzipCompression</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Whether to use gzip compression for network requests.</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>returns a mixpanel instance if needed to keep throughout the project.
You can always get the instance by calling getInstance(name)</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8MixpanelAAC10initialize5token20trackAutomaticEvents13flushInterval12instanceName23optOutTrackingByDefault19useUniqueDistinctId15superProperties17proxyServerConfig0P15GzipCompressionAA0A8InstanceCSS_SbSdSSSgS2bSDySSAA0A4Type_pGSgAA05ProxywX0VSbtFZ"></a>
                    <a name="//apple_ref/swift/Method/initialize(token:trackAutomaticEvents:flushInterval:instanceName:optOutTrackingByDefault:useUniqueDistinctId:superProperties:proxyServerConfig:useGzipCompression:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8MixpanelAAC10initialize5token20trackAutomaticEvents13flushInterval12instanceName23optOutTrackingByDefault19useUniqueDistinctId15superProperties17proxyServerConfig0P15GzipCompressionAA0A8InstanceCSS_SbSdSSSgS2bSDySSAA0A4Type_pGSgAA05ProxywX0VSbtFZ">initialize(token:<wbr>trackAutomaticEvents:<wbr>flushInterval:<wbr>instanceName:<wbr>optOutTrackingByDefault:<wbr>useUniqueDistinctId:<wbr>superProperties:<wbr>proxyServerConfig:<wbr>useGzipCompression:<wbr>)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Initializes an instance of the API with the given project token.</p>

<p>Returns a new Mixpanel instance API object. This allows you to create more than one instance
of the API object, which is convenient if you&rsquo;d like to send data to more than
one Mixpanel project from a single app.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>If you have more than one Mixpanel instance, it is beneficial to initialize
the instances with an instanceName. Then they can be reached by calling getInstance with name.</p>

</div>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">@discardableResult</span>
<span class="kd">open</span> <span class="kd">class</span> <span class="kd">func</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">token</span> <span class="nv">apiToken</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
                           <span class="nv">trackAutomaticEvents</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">,</span>
                           <span class="nv">flushInterval</span><span class="p">:</span> <span class="kt">Double</span> <span class="o">=</span> <span class="mi">60</span><span class="p">,</span>
                           <span class="nv">instanceName</span><span class="p">:</span> <span class="kt">String</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
                           <span class="nv">optOutTrackingByDefault</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
                           <span class="nv">useUniqueDistinctId</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">,</span>
                           <span class="nv">superProperties</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:8Mixpanel10Propertiesa">Properties</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
                           <span class="nv">proxyServerConfig</span><span class="p">:</span> <span class="kt"><a href="../Structs/ProxyServerConfig.html">ProxyServerConfig</a></span><span class="p">,</span>
                           <span class="nv">useGzipCompression</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/MixpanelInstance.html">MixpanelInstance</a></span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>token</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>your project token</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>trackAutomaticEvents</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Whether or not to collect common mobile events</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>flushInterval</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Interval to run background flushing</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>instanceName</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. The name you want to uniquely identify the Mixpanel Instance.
It is useful when you want more than one Mixpanel instance under the same project token.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>optOutTrackingByDefault</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Whether or not to be opted out from tracking by default</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>useUniqueDistinctId</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. whether or not to use the unique device identifier as the distinct_id</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>superProperties</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Super properties dictionary to register during initialization</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>proxyServerConfig</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Setup for proxy server.</p>
                                </div>
                              </td>
                            </tr>
                            <tr>
                              <td>
                                <code>
                                <em>useGzipCompression</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>Optional. Whether to use gzip compression for network requests.</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>returns a mixpanel instance if needed to keep throughout the project.
You can always get the instance by calling getInstance(name)</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/"></a>
                    <a name="//apple_ref/swift/Method/initialize(token:flushInterval:instanceName:optOutTrackingByDefault:useUniqueDistinctId:superProperties:serverURL:useGzipCompression:)" class="dashAnchor"></a>
                    <a class="token" href="#/">initialize(token:<wbr>flushInterval:<wbr>instanceName:<wbr>optOutTrackingByDefault:<wbr>useUniqueDistinctId:<wbr>superProperties:<wbr>serverURL:<wbr>useGzipCompression:<wbr>)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Initializes an instance of the API with the given project token (MAC OS ONLY).</p>

<p>Returns a new Mixpanel instance API object. This allows you to create more than one instance
of the API object, which is convenient if you&rsquo;d like to send data to more than
one Mixpanel project from a single app.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>If you have more than one Mixpanel instance, it is beneficial to initialize
the instances with an instanceName. Then they can be reached by calling getInstance with name.</p>

</div>

                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/"></a>
                    <a name="//apple_ref/swift/Method/initialize(token:flushInterval:instanceName:optOutTrackingByDefault:useUniqueDistinctId:superProperties:proxyServerConfig:useGzipCompression:)" class="dashAnchor"></a>
                    <a class="token" href="#/">initialize(token:<wbr>flushInterval:<wbr>instanceName:<wbr>optOutTrackingByDefault:<wbr>useUniqueDistinctId:<wbr>superProperties:<wbr>proxyServerConfig:<wbr>useGzipCompression:<wbr>)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Initializes an instance of the API with the given project token (MAC OS ONLY).</p>

<p>Returns a new Mixpanel instance API object. This allows you to create more than one instance
of the API object, which is convenient if you&rsquo;d like to send data to more than
one Mixpanel project from a single app.</p>
<div class="aside aside-important">
    <p class="aside-title">Important</p>
    <p>If you have more than one Mixpanel instance, it is beneficial to initialize
the instances with an instanceName. Then they can be reached by calling getInstance with name.</p>

</div>

                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8MixpanelAAC11getInstance4nameAA0aC0CSgSS_tFZ"></a>
                    <a name="//apple_ref/swift/Method/getInstance(name:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8MixpanelAAC11getInstance4nameAA0aC0CSgSS_tFZ">getInstance(name:<wbr>)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Gets the mixpanel instance with the given name</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kd">func</span> <span class="nf">getInstance</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/MixpanelInstance.html">MixpanelInstance</a></span><span class="p">?</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>name</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>the instance name</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>returns the mixpanel instance</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8MixpanelAAC12mainInstanceAA0aC0CyFZ"></a>
                    <a name="//apple_ref/swift/Method/mainInstance()" class="dashAnchor"></a>
                    <a class="token" href="#/s:8MixpanelAAC12mainInstanceAA0aC0CyFZ">mainInstance()</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Returns the main instance that was initialized.</p>

<p>If not specified explicitly, the main instance is always the last instance added</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kd">func</span> <span class="nf">mainInstance</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/MixpanelInstance.html">MixpanelInstance</a></span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>returns the main Mixpanel instance</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8MixpanelAAC16safeMainInstanceAA0aD0CSgyFZ"></a>
                    <a name="//apple_ref/swift/Method/safeMainInstance()" class="dashAnchor"></a>
                    <a class="token" href="#/s:8MixpanelAAC16safeMainInstanceAA0aD0CSgyFZ">safeMainInstance()</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Returns the main Mixpanel instance if it has been initialized.</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">class</span> <span class="kd">func</span> <span class="nf">safeMainInstance</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/MixpanelInstance.html">MixpanelInstance</a></span><span class="p">?</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Return Value</h4>
                        <p>An optional MixpanelInstance, or nil if not yet initialized.</p>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8MixpanelAAC15setMainInstance4nameySS_tFZ"></a>
                    <a name="//apple_ref/swift/Method/setMainInstance(name:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8MixpanelAAC15setMainInstance4nameySS_tFZ">setMainInstance(name:<wbr>)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Sets the main instance based on the instance name</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kd">func</span> <span class="nf">setMainInstance</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>name</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>the instance name</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
                <li class="item">
                  <div>
                    <code>
                    <a name="/s:8MixpanelAAC14removeInstance4nameySS_tFZ"></a>
                    <a name="//apple_ref/swift/Method/removeInstance(name:)" class="dashAnchor"></a>
                    <a class="token" href="#/s:8MixpanelAAC14removeInstance4nameySS_tFZ">removeInstance(name:<wbr>)</a>
                    </code>
                  </div>
                  <div class="height-container">
                    <div class="pointer-container"></div>
                    <section class="section">
                      <div class="pointer"></div>
                      <div class="abstract">
                        <p>Removes an unneeded Mixpanel instance based on its name</p>

                      </div>
                      <div class="declaration">
                        <h4>Declaration</h4>
                        <div class="language">
                          <p class="aside-title">Swift</p>
                          <pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kd">func</span> <span class="nf">removeInstance</span><span class="p">(</span><span class="nv">name</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>

                        </div>
                      </div>
                      <div>
                        <h4>Parameters</h4>
                        <table class="graybox">
                          <tbody>
                            <tr>
                              <td>
                                <code>
                                <em>name</em>
                                </code>
                              </td>
                              <td>
                                <div>
                                  <p>the instance name</p>
                                </div>
                              </td>
                            </tr>
                          </tbody>
                        </table>
                      </div>
                    </section>
                  </div>
                </li>
              </ul>
            </div>
          </section>
        </section>
        <section id="footer">
          <p>&copy; 2025 <a class="link" href="http://mixpanel.com" target="_blank" rel="external noopener">Mixpanel</a>. All rights reserved. (Last updated: 2025-04-24)</p>
          <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
        </section>
      </article>
    </div>
  </body>
</html>
